import os
from utils import ReadXml
from tqdm import tqdm


SrcDir = r"J:\Temp\Temp3"

AlreadyDelete = []

for root, dirs, files in os.walk(SrcDir):
    for file in tqdm(files):
        if file[-1] == 'l':
            Infos = ReadXml(root + "/" + file)
            for Info in Infos:
                if Info[2] - Info[0] > 100 or Info[3] - Info[1] > 100:
                    os.remove(root + "/" + file)
                    os.remove(root + "/" + file[:-3] + "jpg")
                    AlreadyDelete.append(file)
                    break

print("Total delete %d group(xml、jpg) files" % len(AlreadyDelete))
print(AlreadyDelete)
